/**
 * 
 */
package com.dsteiner.gwt.cafeteriasophia.client.model;

import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.dsteiner.gwt.cafeteriasophia.client.domain.ShiftChange;
import com.dsteiner.widgets.client.PropertyChangeCollection;

public class StatisticModel {
	private PropertyChangeCollection propertyChangeSupport = new PropertyChangeCollection(
			this);

	public void addPropertyChangeListener(String propertyName,
			PropertyChangeListener listener) {
		propertyChangeSupport.registerPropertyChangeListener(propertyName,
				listener);
	}
	
	private List<ShiftChange> shiftChanges;

	public List<ShiftChange> getShiftChanges() {
		return shiftChanges;
	}

	public void setShiftChanges(List<ShiftChange> shiftChanges) {
		List<ShiftChange> oldShiftChanges = this.shiftChanges;
		this.shiftChanges = shiftChanges;
		propertyChangeSupport.firePropertyChange("shiftChanges", oldShiftChanges, shiftChanges);
	}
	
	private List<ShiftChange> shiftChangeSelections = new ArrayList<ShiftChange>();

	public List<ShiftChange> getShiftChangeSelections() {
		return shiftChangeSelections;
	}

	public void setShiftChangeSelections(List<ShiftChange> shiftChangeSelections) {
		List<ShiftChange> oldShiftChangeSelections = this.shiftChangeSelections;
		this.shiftChangeSelections = shiftChangeSelections;
		propertyChangeSupport.firePropertyChange("shiftChangeSelections", oldShiftChangeSelections, shiftChangeSelections);
	}
	
	public void addShiftChangeSelection(ShiftChange shiftChange){
		List<ShiftChange> newShiftChangeSelections = new ArrayList<ShiftChange>();
		newShiftChangeSelections.addAll(shiftChangeSelections);
		newShiftChangeSelections.add(shiftChange);
		setShiftChangeSelections(newShiftChangeSelections);
	}
	public void removeShiftChangeSelection(ShiftChange shiftChange){
		List<ShiftChange> newShiftChangeSelections = new ArrayList<ShiftChange>();
		newShiftChangeSelections.addAll(shiftChangeSelections);
		newShiftChangeSelections.remove(shiftChange);
		setShiftChangeSelections(newShiftChangeSelections);
	}
}